@(currentPage: Page[models.production.TaskSpec],currentSortBy: String, currentOrder: String, currentFilter: String)
@link(newPage:Int, newSortBy:String) = @{

    var sortBy = currentSortBy
    var order = currentOrder

    if(newSortBy != null) {
sortBy = newSortBy
        if(currentSortBy == newSortBy) {
if(currentOrder == "asc") {
order = "desc"
            } else {
order = "asc"
            }
        } else {
order = "asc"
        }
    }

    // Generate the link
routes.ProcessTaskController.list(newPage, sortBy, order, currentFilter)

}

@**********************************
* Helper generating table headers *
***********************************@
@header(key:String, title:String, filter:Boolean) = {
<th class='@key.replace(".","_") header @if(currentSortBy == key) @{if(currentOrder == "asc") "headerSortDown" else "headerSortUp"}'>
@if(filter==true){<a href="@link(0, key)">}

    @title
@if(filter==true) {</a>}
</th>
}

@main{

<h1 id="homeTitle">Tìm thấy @currentPage.getTotalRowCount khâu sản xuất</h1>

@if(flash.containsKey("success")) {
<div class="alert-message warning">
    <strong>Done!</strong> @flash.get("success")
</div>
}

<div id="actions">

    <form action='@link(0,"name")' method="GET">
    <input type="search" id="searchbox" name="f" value="@currentFilter" placeholder="Lọc theo tên...">
    <input type="submit" id="searchsubmit" value="Lọc theo tên" class="btn primary">
    </form>

    <a class="btn success" id="add" href="@routes.ProcessTaskController.create()">Thêm khâu sản xuất</a>

</div>
@if(currentPage.getTotalRowCount == 0) {
<iput type="text"></iput>
<div class="well">
    <em>Không có dữ liệu</em>
</div>

} else {

<table class="computers zebra-striped">
    <thead>
    <tr>
    <tr>
        @header("name", "Tên khâu sản xuất",true)
        @header("attNames", "Tên thuộc tính",false)
    </tr>
    </tr>
    </thead>
    <tbody>

    @for(task <- currentPage.getList) {
    <tr>

    </tr>
    }

    </tbody>
</table>
<div id="pagination" class="pagination">
    <ul>
        @if(currentPage.hasPrev) {
        <li class="prev">
            <a href="@link(currentPage.getPageIndex - 1, null)">&larr; Trang trước</a>
        </li>
        } else {
        <li class="prev disabled">
            <a>&larr; Trang trước</a>
        </li>
        }
        <li class="current">
            <a>Hiển thị từ @currentPage.getDisplayXtoYofZ(" đến "," của ")</a>
        </li>
        @if(currentPage.hasNext) {
        <li class="next">
            <a href="@link(currentPage.getPageIndex + 1, null)">Trang tiếp &rarr;</a>
        </li>
        } else {
        <li class="next disabled">
            <a>Trang tiếp &rarr;</a>
        </li>
        }
    </ul>
</div>

}

}